package TestThreadPool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @Author Mr.Wen
 * @Version 1.0
 */
public class Test1 {
    public static void main(String[] args) {
        /*创建线程池*/    /*newCachedThreadPool 可存放无上限线程*/
        ExecutorService fixedThreadPool = Executors.newFixedThreadPool(3);
        ExecutorService pool1 = Executors.newCachedThreadPool();
        /*开启自定义任务*/
//        pool1.execute(new Myrunnable());
        fixedThreadPool.submit(new Myrunnable());
        fixedThreadPool.submit(new Myrunnable());
        fixedThreadPool.submit(new Myrunnable());
        fixedThreadPool.submit(new Myrunnable());
        fixedThreadPool.submit(new Myrunnable());
        /*关线程池*/
        pool1.shutdown();
        fixedThreadPool.shutdown();


    }
}
